home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Interfaces / MPW Interfaces / CIncludes / Aliases.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  5.4 KB  |  137 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Aliases.h
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. */
  11.  
  12. #ifndef __ALIASES__
  13. #define __ALIASES__
  14.  
  15. #ifndef __TYPES__
  16. #include <Types.h>
  17. #endif
  18.  
  19. #ifndef __APPLETALK__
  20. #include <AppleTalk.h>
  21. #endif
  22.  
  23. #ifndef __FILES__
  24. #include <Files.h>
  25. #endif
  26.  
  27.  
  28. enum {
  29.  
  30.  
  31. #define rAliasType 'alis'                                           /* Aliases are stored as resources of this type */
  32.  
  33. /* define alias resolution action rules mask */
  34.  
  35.     kARMMountVol = 0x00000001,                                      /* mount the volume automatically */
  36.     kARMNoUI = 0x00000002,                                          /* no user interface allowed during resolution */
  37.     kARMMultVols = 0x00000008,                                      /* search on multiple volumes */
  38.     kARMSearch = 0x00000100,                                        /* search quickly */
  39.     kARMSearchMore = 0x00000200,                                    /* search further */
  40.     kARMSearchRelFirst = 0x00000400,                                /* search target on a relative path first */
  41.  
  42. /* define alias record information types */
  43.     asiZoneName = -3,                                               /* get zone name */
  44.     asiServerName = -2,                                             /* get server name */
  45.     asiVolumeName = -1,                                             /* get volume name */
  46.     asiAliasName = 0,                                               /* get aliased file/folder/volume name */
  47.     asiParentName = 1                                               /* get parent folder name */
  48.  
  49. };
  50.  
  51. /* define the alias record that will be the blackbox for the caller */
  52. struct AliasRecord {
  53.     OSType userType;                                                /* appl stored type like creator type */
  54.     unsigned short aliasSize;                                       /* alias record size in bytes, for appl usage */
  55. };
  56.  
  57. typedef struct AliasRecord AliasRecord;
  58. typedef AliasRecord *AliasPtr, **AliasHandle;
  59.  
  60.  
  61. typedef short AliasInfoType;                                        /* alias record information type */
  62. typedef pascal Boolean (*AliasFilterProcPtr) (CInfoPBPtr cpbPtr,    /*I*/
  63. Boolean *quitFlag,                                                  /*O*/
  64. Ptr yourDataPtr);                                                   /*I*/
  65.  
  66. #ifdef __cplusplus
  67. extern "C" {
  68. #endif
  69. /*  create a new alias between fromFile-target and return alias record handle  */
  70. pascal OSErr NewAlias(const FSSpec *fromFile,
  71.                       const FSSpec *target,
  72.                       AliasHandle *alias)
  73.     = {0x7002,0xA823}; 
  74. /* create a minimal new alias for a target and return alias record handle */
  75. pascal OSErr NewAliasMinimal(const FSSpec *target,
  76.                              AliasHandle *alias)
  77.     = {0x7008,0xA823}; 
  78. /* create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  */
  79. pascal OSErr NewAliasMinimalFromFullPath(short fullPathLength,
  80.                                          const unsigned char *fullPath,
  81.                                          ConstStr32Param zoneName,
  82.                                          ConstStr31Param serverName,
  83.                                          AliasHandle *alias)
  84.     = {0x7009,0xA823}; 
  85. #define NewAliasMinimalFromFullpath NewAliasMinimalFromFullPath
  86.  
  87. /* given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. */
  88. pascal OSErr ResolveAlias(const FSSpec *fromFile,
  89.                           AliasHandle alias,
  90.                           FSSpec *target,
  91.                           Boolean *wasChanged)
  92.     = {0x7003,0xA823}; 
  93. /* given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. */
  94. pascal OSErr GetAliasInfo(const AliasHandle alias,
  95.                           AliasInfoType index,
  96.                           Str63 theString)
  97.     = {0x7007,0xA823}; 
  98.  
  99. /* 
  100.      given a file spec, return target file spec if input file spec is an alias.
  101.         It resolves the entire alias chain or one step of the chain.  It returns
  102.         info about whether the target is a folder or file; and whether the input
  103.         file spec was an alias or not. 
  104. */
  105.  
  106. pascal OSErr ResolveAliasFile(FSSpec *theSpec,
  107.                               Boolean resolveAliasChains,
  108.                               Boolean *targetIsFolder,
  109.                               Boolean *wasAliased)
  110.     = {0x700C,0xA823}; 
  111.  
  112. /* 
  113.       Low Level Routines 
  114.     given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
  115. */
  116.  
  117. pascal OSErr MatchAlias(const FSSpec *fromFile,
  118.                         unsigned long rulesMask,
  119.                         const AliasHandle alias,
  120.                         short *aliasCount,
  121.                         FSSpecArrayPtr aliasList,
  122.                         Boolean *needsUpdate,
  123.                         AliasFilterProcPtr aliasFilter,
  124.                         void *yourDataPtr)
  125.     = {0x7005,0xA823}; 
  126. /* given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. */
  127. pascal OSErr UpdateAlias(const FSSpec *fromFile,
  128.                          const FSSpec *target,
  129.                          AliasHandle alias,
  130.                          Boolean *wasChanged)
  131.     = {0x7006,0xA823}; 
  132. #ifdef __cplusplus
  133. }
  134. #endif
  135.  
  136. #endif
  137.